using System;
using OptixDotNet;
using OptixDotNet.Math;
using RayDen.Library.Entity.Frames;
using RayDen.Optix.Engine.Scene;
using Buffer = OptixDotNet.Buffer;

namespace RayDen.Optix.Engine.Components
{
    public class RenderEngine
    {
        public const uint sqrtSamples = 2u;
        public const uint maxDepth = 8u;
        public const uint rrBeginDepth = 4u;
        protected string PtxDir;

        protected Context Context;
        internal Buffer OutputBuffer;

        public OptixEngineSettings Settings;

        public SceneInfo Scene;

        public RenderEngine()
        {
            Settings = new OptixEngineSettings();
        }

        public string GetStatistics()
        {
            return string.Empty;
        }

        public Context CreateContext()
        {
            PtxDir = @"G:\Git\RayDen\Engines\RayDen.Optix.Engine\Scripts\";
            this.Context = new Context();
            Context.RayTypeCount = 2;
            Context.EntryPointCount = 1;
            Context.EnableAllExceptions = false;
            EngineContext.Instance.OptixContext = this.Context;
            return Context;
        }

        public virtual void OnKeyPressed(OpenTK.Input.KeyboardKeyEventArgs e)
        {
        }

        public virtual void UpdateFrame()
        {
        }

        public virtual void Initialize(Action<BoundingBox> setCamera, params object[] parameters)
        {
        }

        public virtual  void OpenFrame(string framePath)
        {
        }

        public virtual void OpenFrame(FrameDescription frame)
        {
        }

        internal virtual void StartRendering()
        {
            throw new NotImplementedException();
        }

        internal virtual void StopRendering()
        {
            throw new NotImplementedException();
        }
    }
}